<!DOCTYPE html>
<html>
<head>
    <title>Intermediate Value Models - Comparison Report</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            margin: 20px;
            background-color: #f5f5f5;
        }
        .container {
            max-width: 1400px;
            margin: 0 auto;
            background-color: white;
            padding: 30px;
            box-shadow: 0 0 10px rgba(0,0,0,0.1);
        }
        h1 {
            color: #333;
            border-bottom: 3px solid #4CAF50;
            padding-bottom: 10px;
        }
        h2 {
            color: #555;
            margin-top: 30px;
        }
        table {
            border-collapse: collapse;
            width: 100%;
            margin: 20px 0;
        }
        th, td {
            border: 1px solid #ddd;
            padding: 12px;
            text-align: left;
        }
        th {
            background-color: #4CAF50;
            color: white;
        }
        tr:nth-child(even) {
            background-color: #f9f9f9;
        }
        .sig-high { background-color: #d4edda; }
        .sig-medium { background-color: #fff3cd; }
        .sig-low { background-color: #f8d7da; }
        .metric { font-weight: bold; }
        .timestamp {
            color: #888;
            font-size: 0.9em;
        }
        img {
            max-width: 100%;
            margin: 20px 0;
            border: 1px solid #ddd;
        }
    </style>
</head>
<body>
    <div class="container">
        <h1>Intermediate Value Models - Correlation Analysis Report</h1>
        <p class="timestamp">Generated: 2025-10-13 20:52:54</p>
        
        <h2>Overall Ranking (Top 20)</h2>
        <table>
            <tr>
                <th>Rank</th>
                <th>Algorithm</th>
                <th>Model</th>
                <th>|Pearson|</th>
                <th>P-value</th>
                <th>Significance</th>
                <th>CPU Mean</th>
            </tr>

            <tr class="sig-medium">
                <td>1</td>
                <td>SM2</td>
                <td>point_add_x</td>
                <td class="metric">0.2404</td>
                <td>0.016545</td>
                <td>weak</td>
                <td>46.97%</td>
            </tr>

            <tr class="sig-medium">
                <td>2</td>
                <td>SM2</td>
                <td>scalar_mult_step</td>
                <td class="metric">0.2095</td>
                <td>0.036468</td>
                <td>weak</td>
                <td>47.55%</td>
            </tr>

            <tr class="sig-low">
                <td>3</td>
                <td>RSA-2048</td>
                <td>square_op</td>
                <td class="metric">0.1424</td>
                <td>0.159583</td>
                <td>weak</td>
                <td>46.50%</td>
            </tr>

            <tr class="sig-low">
                <td>4</td>
                <td>RSA-2048</td>
                <td>modular_add</td>
                <td class="metric">0.1323</td>
                <td>0.196382</td>
                <td>weak</td>
                <td>48.09%</td>
            </tr>

            <tr class="sig-low">
                <td>5</td>
                <td>ECC-P256</td>
                <td>point_add_x</td>
                <td class="metric">0.1003</td>
                <td>0.325965</td>
                <td>weak</td>
                <td>48.07%</td>
            </tr>

            <tr class="sig-low">
                <td>6</td>
                <td>ECC-P256</td>
                <td>hw_coordinate</td>
                <td class="metric">0.0979</td>
                <td>0.335032</td>
                <td>very_weak</td>
                <td>46.39%</td>
            </tr>

            <tr class="sig-low">
                <td>7</td>
                <td>SM2</td>
                <td>modular_op</td>
                <td class="metric">0.0949</td>
                <td>0.352725</td>
                <td>very_weak</td>
                <td>47.15%</td>
            </tr>

            <tr class="sig-low">
                <td>8</td>
                <td>AES-128</td>
                <td>sbox_output</td>
                <td class="metric">0.0849</td>
                <td>0.400829</td>
                <td>very_weak</td>
                <td>47.49%</td>
            </tr>

            <tr class="sig-low">
                <td>9</td>
                <td>AES-128</td>
                <td>round_key_xor</td>
                <td class="metric">0.0819</td>
                <td>0.420189</td>
                <td>very_weak</td>
                <td>48.41%</td>
            </tr>

            <tr class="sig-low">
                <td>10</td>
                <td>RSA-2048</td>
                <td>hw_result</td>
                <td class="metric">0.0776</td>
                <td>0.447775</td>
                <td>very_weak</td>
                <td>46.37%</td>
            </tr>

            <tr class="sig-low">
                <td>11</td>
                <td>ECC-P256</td>
                <td>scalar_mult_step</td>
                <td class="metric">0.0659</td>
                <td>0.521440</td>
                <td>very_weak</td>
                <td>48.48%</td>
            </tr>

            <tr class="sig-low">
                <td>12</td>
                <td>SM2</td>
                <td>point_dbl_x</td>
                <td class="metric">0.0565</td>
                <td>0.582492</td>
                <td>very_weak</td>
                <td>46.01%</td>
            </tr>

            <tr class="sig-low">
                <td>13</td>
                <td>Dilithium-2</td>
                <td>modular_red</td>
                <td class="metric">0.0514</td>
                <td>0.617353</td>
                <td>very_weak</td>
                <td>48.98%</td>
            </tr>

            <tr class="sig-low">
                <td>14</td>
                <td>SM4</td>
                <td>sbox_output</td>
                <td class="metric">0.0462</td>
                <td>0.649579</td>
                <td>very_weak</td>
                <td>42.92%</td>
            </tr>

            <tr class="sig-low">
                <td>15</td>
                <td>Dilithium-2</td>
                <td>ntt_butterfly</td>
                <td class="metric">0.0422</td>
                <td>0.678431</td>
                <td>very_weak</td>
                <td>98.70%</td>
            </tr>

            <tr class="sig-low">
                <td>16</td>
                <td>SM4</td>
                <td>sbox_input</td>
                <td class="metric">0.0414</td>
                <td>0.684453</td>
                <td>very_weak</td>
                <td>47.58%</td>
            </tr>

            <tr class="sig-low">
                <td>17</td>
                <td>Dilithium-2</td>
                <td>rejection_sampling</td>
                <td class="metric">0.0387</td>
                <td>0.705344</td>
                <td>very_weak</td>
                <td>47.67%</td>
            </tr>

            <tr class="sig-low">
                <td>18</td>
                <td>SM4</td>
                <td>hw_sbox_output</td>
                <td class="metric">0.0367</td>
                <td>0.717176</td>
                <td>very_weak</td>
                <td>44.80%</td>
            </tr>

            <tr class="sig-low">
                <td>19</td>
                <td>Dilithium-2</td>
                <td>poly_mult</td>
                <td class="metric">0.0324</td>
                <td>0.750515</td>
                <td>very_weak</td>
                <td>49.79%</td>
            </tr>

            <tr class="sig-low">
                <td>20</td>
                <td>SM4</td>
                <td>round_function_input</td>
                <td class="metric">0.0310</td>
                <td>0.761021</td>
                <td>very_weak</td>
                <td>44.56%</td>
            </tr>

        </table>
        
        <h2>Visualization</h2>
        <img src="overall_ranking.png" alt="Overall Ranking">
        <img src="algorithm_comparison.png" alt="Algorithm Comparison">
        
        <h2>By Algorithm</h2>

        <h3>AES-128</h3>
        <table>
            <tr>
                <th>Model</th>
                <th>|Pearson|</th>
                <th>P-value</th>
                <th>Significance</th>
                <th>Spearman</th>
                <th>CPU Mean</th>
                <th>Unique Values</th>
            </tr>

            <tr class="sig-low">
                <td>sbox_output</td>
                <td class="metric">0.0849</td>
                <td>0.400829</td>
                <td>very_weak</td>
                <td>0.0425</td>
                <td>47.49%</td>
                <td>82</td>
            </tr>

            <tr class="sig-low">
                <td>round_key_xor</td>
                <td class="metric">0.0819</td>
                <td>0.420189</td>
                <td>very_weak</td>
                <td>0.0548</td>
                <td>48.41%</td>
                <td>85</td>
            </tr>

            <tr class="sig-low">
                <td>hd_plaintext_sbox</td>
                <td class="metric">0.0218</td>
                <td>0.831863</td>
                <td>very_weak</td>
                <td>0.0239</td>
                <td>49.43%</td>
                <td>7</td>
            </tr>

            <tr class="sig-low">
                <td>sbox_input</td>
                <td class="metric">0.0188</td>
                <td>0.854442</td>
                <td>very_weak</td>
                <td>-0.0732</td>
                <td>47.71%</td>
                <td>82</td>
            </tr>

            <tr class="sig-low">
                <td>hw_round_key_xor</td>
                <td class="metric">0.0093</td>
                <td>0.926903</td>
                <td>very_weak</td>
                <td>-0.0060</td>
                <td>48.20%</td>
                <td>8</td>
            </tr>

            <tr class="sig-low">
                <td>hw_sbox_output</td>
                <td class="metric">0.0044</td>
                <td>0.965887</td>
                <td>very_weak</td>
                <td>-0.0427</td>
                <td>46.80%</td>
                <td>7</td>
            </tr>

        </table>

        <h3>Dilithium-2</h3>
        <table>
            <tr>
                <th>Model</th>
                <th>|Pearson|</th>
                <th>P-value</th>
                <th>Significance</th>
                <th>Spearman</th>
                <th>CPU Mean</th>
                <th>Unique Values</th>
            </tr>

            <tr class="sig-low">
                <td>modular_red</td>
                <td class="metric">0.0514</td>
                <td>0.617353</td>
                <td>very_weak</td>
                <td>0.0411</td>
                <td>48.98%</td>
                <td>100</td>
            </tr>

            <tr class="sig-low">
                <td>ntt_butterfly</td>
                <td class="metric">0.0422</td>
                <td>0.678431</td>
                <td>very_weak</td>
                <td>-0.0359</td>
                <td>98.70%</td>
                <td>100</td>
            </tr>

            <tr class="sig-low">
                <td>rejection_sampling</td>
                <td class="metric">0.0387</td>
                <td>0.705344</td>
                <td>very_weak</td>
                <td>0.0960</td>
                <td>47.67%</td>
                <td>100</td>
            </tr>

            <tr class="sig-low">
                <td>poly_mult</td>
                <td class="metric">0.0324</td>
                <td>0.750515</td>
                <td>very_weak</td>
                <td>-0.0094</td>
                <td>49.79%</td>
                <td>100</td>
            </tr>

        </table>

        <h3>ECC-P256</h3>
        <table>
            <tr>
                <th>Model</th>
                <th>|Pearson|</th>
                <th>P-value</th>
                <th>Significance</th>
                <th>Spearman</th>
                <th>CPU Mean</th>
                <th>Unique Values</th>
            </tr>

            <tr class="sig-low">
                <td>point_add_x</td>
                <td class="metric">0.1003</td>
                <td>0.325965</td>
                <td>weak</td>
                <td>0.1134</td>
                <td>48.07%</td>
                <td>100</td>
            </tr>

            <tr class="sig-low">
                <td>hw_coordinate</td>
                <td class="metric">0.0979</td>
                <td>0.335032</td>
                <td>very_weak</td>
                <td>0.0384</td>
                <td>46.39%</td>
                <td>15</td>
            </tr>

            <tr class="sig-low">
                <td>scalar_mult_step</td>
                <td class="metric">0.0659</td>
                <td>0.521440</td>
                <td>very_weak</td>
                <td>0.1202</td>
                <td>48.48%</td>
                <td>100</td>
            </tr>

            <tr class="sig-low">
                <td>point_dbl_x</td>
                <td class="metric">0.0275</td>
                <td>0.786904</td>
                <td>very_weak</td>
                <td>0.0426</td>
                <td>46.39%</td>
                <td>100</td>
            </tr>

        </table>

        <h3>RSA-2048</h3>
        <table>
            <tr>
                <th>Model</th>
                <th>|Pearson|</th>
                <th>P-value</th>
                <th>Significance</th>
                <th>Spearman</th>
                <th>CPU Mean</th>
                <th>Unique Values</th>
            </tr>

            <tr class="sig-low">
                <td>square_op</td>
                <td class="metric">0.1424</td>
                <td>0.159583</td>
                <td>weak</td>
                <td>0.1529</td>
                <td>46.50%</td>
                <td>100</td>
            </tr>

            <tr class="sig-low">
                <td>modular_add</td>
                <td class="metric">0.1323</td>
                <td>0.196382</td>
                <td>weak</td>
                <td>0.1256</td>
                <td>48.09%</td>
                <td>100</td>
            </tr>

            <tr class="sig-low">
                <td>hw_result</td>
                <td class="metric">0.0776</td>
                <td>0.447775</td>
                <td>very_weak</td>
                <td>0.0524</td>
                <td>46.37%</td>
                <td>13</td>
            </tr>

            <tr class="sig-low">
                <td>modular_mult</td>
                <td class="metric">0.0264</td>
                <td>0.797240</td>
                <td>very_weak</td>
                <td>-0.0362</td>
                <td>49.02%</td>
                <td>100</td>
            </tr>

        </table>

        <h3>SM2</h3>
        <table>
            <tr>
                <th>Model</th>
                <th>|Pearson|</th>
                <th>P-value</th>
                <th>Significance</th>
                <th>Spearman</th>
                <th>CPU Mean</th>
                <th>Unique Values</th>
            </tr>

            <tr class="sig-medium">
                <td>point_add_x</td>
                <td class="metric">0.2404</td>
                <td>0.016545</td>
                <td>weak</td>
                <td>0.2609</td>
                <td>46.97%</td>
                <td>100</td>
            </tr>

            <tr class="sig-medium">
                <td>scalar_mult_step</td>
                <td class="metric">0.2095</td>
                <td>0.036468</td>
                <td>weak</td>
                <td>-0.1853</td>
                <td>47.55%</td>
                <td>100</td>
            </tr>

            <tr class="sig-low">
                <td>modular_op</td>
                <td class="metric">0.0949</td>
                <td>0.352725</td>
                <td>very_weak</td>
                <td>-0.1002</td>
                <td>47.15%</td>
                <td>100</td>
            </tr>

            <tr class="sig-low">
                <td>point_dbl_x</td>
                <td class="metric">0.0565</td>
                <td>0.582492</td>
                <td>very_weak</td>
                <td>0.0661</td>
                <td>46.01%</td>
                <td>100</td>
            </tr>

        </table>

        <h3>SM4</h3>
        <table>
            <tr>
                <th>Model</th>
                <th>|Pearson|</th>
                <th>P-value</th>
                <th>Significance</th>
                <th>Spearman</th>
                <th>CPU Mean</th>
                <th>Unique Values</th>
            </tr>

            <tr class="sig-low">
                <td>sbox_output</td>
                <td class="metric">0.0462</td>
                <td>0.649579</td>
                <td>very_weak</td>
                <td>0.0313</td>
                <td>42.92%</td>
                <td>80</td>
            </tr>

            <tr class="sig-low">
                <td>sbox_input</td>
                <td class="metric">0.0414</td>
                <td>0.684453</td>
                <td>very_weak</td>
                <td>-0.0512</td>
                <td>47.58%</td>
                <td>83</td>
            </tr>

            <tr class="sig-low">
                <td>hw_sbox_output</td>
                <td class="metric">0.0367</td>
                <td>0.717176</td>
                <td>very_weak</td>
                <td>-0.0773</td>
                <td>44.80%</td>
                <td>7</td>
            </tr>

            <tr class="sig-low">
                <td>round_function_input</td>
                <td class="metric">0.0310</td>
                <td>0.761021</td>
                <td>very_weak</td>
                <td>0.0121</td>
                <td>44.56%</td>
                <td>85</td>
            </tr>

            <tr class="sig-low">
                <td>tau_transform</td>
                <td class="metric">0.0118</td>
                <td>0.907523</td>
                <td>very_weak</td>
                <td>0.0009</td>
                <td>47.97%</td>
                <td>100</td>
            </tr>

        </table>

        <h2>Legend</h2>
        <ul>
            <li><strong>|Pearson|:</strong> Absolute value of Pearson correlation coefficient (0-1)</li>
            <li><strong>P-value:</strong> Statistical significance (< 0.05 is significant)</li>
            <li><strong>Significance:</strong> Correlation strength category</li>
            <li><strong>CPU Mean:</strong> Average CPU usage during trace collection</li>
            <li class="sig-high">Green background: Highly significant (p < 0.01)</li>
            <li class="sig-medium">Yellow background: Significant (p < 0.05)</li>
            <li class="sig-low">Red background: Not significant (p >= 0.05)</li>
        </ul>
    </div>
</body>
</html>
